# 211227 0104

# 迭代器与生成器

l1 = [1,2,3,4]
it = iter(l1)
print(next(it))
print(next(it))
print(next(it))
print(next(it))
# 异常：StopIteration
#print(next(it))
print('END.14')

# for 遍历迭代器
for x in it:
	print(x, end=" ")

# 捕获异常 遍历
import sys
l2 = [11,12,13,14]
it2 = iter(l2)
while True:
	try:
		print(next(it2))
	except StopIteration:
		# sys.exit()
		print('捕获到 StopIteration. break')
		break
print('END.26')

